package com.xxl.controller;

import com.xxl.dto.UserDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * @author xxl
 * @date 2023/4/4
 */
@Tag(name = "AdminApi",description = "管理员身份使用的接口")
@Validated
public interface AdminApi<T> {
    /**
     * 管理源权限：查询所有的博客
     * @param
     * @return
     */
    @Operation(summary = "admin身份：查询所有的博客信息")
    @ApiResponse(description = "没有权限",responseCode = "404")
    @ApiResponse(description = "未知错误",responseCode = "500")
    @ApiResponse(description = "查询成功",responseCode = "200")
    T queryAllBlog();

    /**
     * 管理源权限：查看所有的用户
     * @return T
     */
    @Operation(summary = "admin身份：查看所有的用户")
    @ApiResponse(description = "没有权限",responseCode = "404")
    @ApiResponse(description = "未知错误",responseCode = "500")
    @ApiResponse(description = "查询成功",responseCode = "200")
    T queryAllUser();

    /**
     * 管理源权限：修改一个用户角色
     * @param roleId
     * @param username
     * @return T
     */
    @Operation(summary = "admin身份：修改一个用户的角色(1: 身份：管理员，权限：super，2：身份：普通用户，权限：normal，3：身份：普通用户，权限：vip1，后续可以通过数据库继续开发新的权限)")
    @ApiResponse(description = "没有权限",responseCode = "404")
    @ApiResponse(description = "未知错误",responseCode = "500")
    @ApiResponse(description = "修改成功",responseCode = "200")
    @Parameter(name = "roleId",description = "角色id")
    @Parameter(name = "username",description = "修改哪一个用户")
    T modifyUserRole(@Min(value = 1,message = "最小必须为1") @Max(value = 3,message = "最大必须为3") int roleId,String username);

    /**
     * 删除用户
     * @param username
     * @return T
     */
    @Operation(summary = "admin身份：删除一个用户")
    @ApiResponse(description = "没有权限",responseCode = "404")
    @ApiResponse(description = "未知错误",responseCode = "500")
    @ApiResponse(description = "删除成功",responseCode = "200")
    @Parameter(name = "username",description = "用户名")
    T deleteUserByName(String username);

    /**
     * 删除博客
     * @param  uuid
     * @return  T
     */
    @Operation(summary = "admin身份：删除一篇博客")
    @ApiResponse(description = "没有权限",responseCode = "404")
    @ApiResponse(description = "未知错误",responseCode = "500")
    @ApiResponse(description = "删除成功",responseCode = "200")
    @Parameter(name = "uuid",description = "博客id")
    T deleteBlogByUuid(String uuid);
}
